package com.nike.model.query;
import java.math.BigInteger;

import com.jfinal.plugin.activerecord.Page;
import com.nike.model.Menu;
import com.jfinal.plugin.ehcache.IDataLoader;
public class MenuQuery extends JBaseQuery {
	private static final Menu DAO = new Menu();
	private static final MenuQuery QUERY = new MenuQuery();
	
	
	
	public static MenuQuery me(){
		return QUERY;
	}
	
	/**
	 * 分页
	 * @param pageNumber
	 * @param pageSize
	 * @return
	 */
	public Page<Menu> paginate(int pageNumber, int pageSize) {
		return DAO.doPaginate(pageNumber, pageSize);
	}
	
	/**
	 * 查询menu条数
	 * @return
	 */
	public long findCount() {
		return DAO.doFindCount();
	}
	/**
	 * 根据id查询
	 * @param userId
	 * @return
	 */
	public Menu findById(final BigInteger id) {
		return DAO.getCache(id, new IDataLoader() {
			@Override
			public Object load() {
				return DAO.findById(id);
			}
		});
	}


}
